package com.dhy.controller.listener;

import ch.qos.logback.core.net.server.ServerListener;
import com.dhy.service.imp.AutoScanPermissionServiceImpl2;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

@WebListener
public class PermissionListener implements ServletContextListener {

    @Autowired
    AutoScanPermissionServiceImpl2 autoScanPermissionServiceImpl2;

    @Override
    public void contextInitialized(ServletContextEvent sce) {

        System.out.println("Permission监听器初始化开始");
        autoScanPermissionServiceImpl2.scan();
        System.out.println("Permission监听器初始化结束");
    }

    @Override
    public void contextDestroyed(ServletContextEvent sce) {

        System.out.println("Permission监听器销毁");
    }
}
